updating oE machine free

`free` also used in `pseudo memory`


Memory Disposal

free

include machine.e 
namespace machine 
public procedure free(object addr) 

frees up a previously allocated block of memory.

Parameters:
  1. addr, either a single atom or a sequence of atoms; these are addresses of a blocks to free.
Comments:
  • Use free to return blocks of memory the during execution. This will reduce the chance of running out of memory or getting into excessive virtual memory swapping to disk.
  • Do not reference a block of memory that has been freed.
  • When your program terminates, all allocated memory will be returned to the system.
  • addr must have been allocated previously using allocate. You cannot use it to relinquish part of a block. Instead, you have to allocate a block of the new size, copy useful contents from old block there and then free the old block.
  • If the memory was allocated and automatic cleanup was specified, then do not call free directly. Instead, use delete.
  • An addr of zero is simply ignored.
Example 1:

demo/callmach.ex

See Also:

Using Data Bytes, Using Data Words, Using Data Double Words, Using Strings, allocate_data, free_code

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu